home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / win / pascal / itsybit.exe / IBTEST.PAS < prev    next >
Pascal/Delphi Source File  |  1993-01-12  |  4KB  |  123 lines

  1. program IBTest;
  2.  
  3. {
  4.   Program:            IBTEST.PAS
  5.   Version:            1.0
  6.   Creation Date:      January 12, 1993
  7.   Modification Date:  January 12, 1993
  8.   Operating System:   MS-DOS 3.x and Windows 3.1
  9.   Hardware Required:  Windows-capable computer system
  10.   Programming System: Borland Pascal for Windows 7.0
  11.   Author:             Craig Boyd
  12.   Ownership:          Copyright (c) 1993 by Craig Boyd
  13.  
  14.  
  15.   About This Program
  16.  
  17.   This program demonstrates how to use the ITSYBITS unit to create windows
  18.   with small horizontal or vertical captions.  There are some limitations.
  19.   Windows with small captions cannot have menus (other than the system
  20.   menu) and they cannot have minimize or maximize buttons.  Support for
  21.   minimize and maximize buttons has been left as an exercise for the
  22.   reader.  See the comments in ITSYBITS.PAS for info on where to find
  23.   the original C version of ITSYBITS, which contains complete
  24.   documentation and comments from the orignal author.
  25.  
  26.   The ITSYBITS unit declares a descendant of TWindow called
  27.   TIstyBitsWindow.  Derive your windows from this type if you want them to
  28.   have small captions.
  29.  
  30.   ItsyBits windows are ideal for use as tool palettes.  They act like
  31.   normal windows, yet they are visually distinct from other windows.
  32.  
  33.  
  34.   Update History
  35.  
  36.   update    ver   description (author)
  37.   -------   ---   -----------
  38.   9301.12   1.0   First release.
  39. }
  40.  
  41. {$R-,S-,W-,X+}
  42.  
  43. uses
  44.   WinTypes,
  45.   WinProcs,
  46.   OWindows,
  47.   ItsyBits;
  48.  
  49. {$D Copyright (c) 1993 by Craig Boyd}
  50.  
  51. {-- Global Declarations -------------------------------------------------}
  52.  
  53. const
  54.   AppName  : pchar = 'IBTest';
  55.   AppTitle : pchar = 'ItsyBits Test';
  56.  
  57. type
  58.   TTestApp = object(TApplication)
  59.     procedure InitMainWindow; virtual;
  60.    end;
  61.  
  62.   PMainWindow = ^TMainWindow;
  63.   TMainWindow = object(TWindow)
  64.     Win1,
  65.     Win2 : PItsyBitsWindow;
  66.     constructor Init(aParent: PWindowsObject; aTitle: PChar);
  67.   end;
  68.  
  69. {-- TMainWindow Methods -------------------------------------------------}
  70.  
  71. constructor TMainWindow.Init;
  72.   begin
  73.     inherited Init(aParent,aTitle);
  74.     {
  75.       This has nothing to do with using TItsyBitsWindows, but just for
  76.       fun we're gonna center our main window on the screen.
  77.     }
  78.     with Attr do begin
  79.       W := (GetSystemMetrics(sm_CXScreen) div 10) * 8;  { 80% of screen width }
  80.       H := (GetSystemMetrics(sm_CYScreen) div 10) * 6; { 60% of screen height }
  81.       X := (GetSystemMetrics(sm_CXScreen) - W) div 2;
  82.       Y := (GetSystemMetrics(sm_CYScreen) - H) div 2;
  83.     end;
  84.     {
  85.       Create a couple of TItsyBitsWindows.
  86.     }
  87.     Win1 := new(PItsyBitsWindow,Init(@Self,'Horz ItsyBits',ibs_HorzCaption));
  88.     Win2 := new(PItsyBitsWindow,Init(@Self,'Vert ItsyBits',ibs_VertCaption));
  89.     {
  90.       Let's size and position them, relative to the main window.
  91.     }
  92.     with Win1^.Attr do begin
  93.       X := 50 + Attr.X;
  94.       Y := 90 + Attr.Y;
  95.       W := 100;
  96.       H := 300;
  97.     end;
  98.     with Win2^.Attr do begin
  99.       X := 200 + Attr.X;
  100.       Y := 90 + Attr.Y;
  101.       W := 300;
  102.       H := 100;
  103.     end;
  104.   end { TMainWindow.Init };
  105.  
  106. {-- TTestApp Methods ----------------------------------------------------}
  107.  
  108. procedure TTestApp.InitMainWindow;
  109.   begin
  110.     MainWindow:= new(PMainWindow,Init(nil,AppTitle));
  111.   end { TTestApp.InitMainWindow };
  112.  
  113. {-- Main Program --------------------------------------------------------}
  114.  
  115. var
  116.   TestApp : TTestApp;
  117.  
  118. begin
  119.   TestApp.Init(AppName);
  120.   TestApp.Run;
  121.   TestApp.Done;
  122. end.
  123.